import Vue from 'vue';
import VueRouter from 'vue-router';

// import Home from '../views/Home.vue'
// import About from '../views/About.vue'

Vue.use(VueRouter);

const router = new VueRouter({
    routes: [
        {
            path: '/',
            component: () => {
                return import(/* webpackChunkName: 'home' */ '../views/Home.vue').then(module => {
                    console.log('Home 加载成功');

                    // 这里需要返回相同的对象
                    return module;
                });
            }
        },

        {
            path: '/about',
            component: () => {
                return import(/* webpackChunkName: 'about' */ '../views/About.vue');
            }
        }
    ]
});

export default router;
